<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<?php
/* 商品信息放入回收站处理页 */
require_once("../../conn/conn_db.php");    //包含数据库连接文件
if( $_GET["p_id"]!= ""  &&  $_GET["Type"]!= "")
{
    $pid = $_GET["p_id"];  //获取传递的商品编号
    $type = $_GET["Type"];         //获取传递的操作类型
    $sql ="";
    switch ($type)
    {
        case "1":
            $sql = "update product_info set p_status=1 where p_id=".$pid;  //更新语句
            break;
        case "2":
            $sql = "update product_info set p_status=2 where p_id=".$pid;  //更新语句
            break;
		case "3":
            $sql = "delete from product_info where p_id=".$pid;  //删除语句
            break;
    }
    $update = $conn->query($sql); //执行SQL语句
    if($update)                  //判断执行结果
    {
        echo "<script>alert('操作成功！');self.location='../product_manager.php'</script>";
    }
    else
    {
        echo "<script>alert('操作失败！');self.location='../product_manager.php'</script>";
    }
}
else
{
    echo "<script>alert('请选择要操作的商品信息！');self.location='../product_manager.php'</script>";
}
?>
</body>
</html>